package com.weic.dao;

import com.weic.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 *
 */
@Repository
public class UserDaoImpl implements UserDao{

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public int addUser(User user) {
        String sql = "insert into user(id,username,loc,age) value(default,?,?,?)";
        Object[] args = {user.getUserName(),user.getLco(),user.getAge()};
        return jdbcTemplate.update(sql, args);
    }
}
